package com.example.service.serviceImp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.example.dao.OrderMapper;
import com.example.pojo.Order;
import com.example.pojo.Share;
import com.example.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;

@Service("OrderService")
public class OrderServiceImpl implements OrderService {
    @Autowired
    public OrderMapper orderMapper;

    @Override
    public int addNewOrder(Order order) {
        orderMapper.insert(order);
        return 1;
    }


    @Override
    public Object selectOrder(Integer userId) {
        QueryWrapper<Order> queryWrapper=new QueryWrapper<>();
        queryWrapper.eq("userId",userId);
        List<Order> orderList=orderMapper.selectList(queryWrapper);
        return orderList;
    }

    @Override
    public int deleteOrder(Integer orderId) {
        orderMapper.deleteById(orderId);
        return 1;
    }
}
